<meta charset="utf-8">
(#) Spelling error

!!! WARNING: Spelling error
   This is a warning.

Id
:   `Typos`
Summary
:   Spelling error
Severity
:   Warning
Category
:   Correctness: Messages
Platform
:   Android
Vendor
:   Android Open Source Project
Feedback
:   https://issuetracker.google.com/issues/new?component=192708
Since
:   Initial
Affects
:   Resource files
Editing
:   This check runs on the fly in the IDE editor
Implementation
:   [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/TypoDetector.kt)
Tests
:   [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/TypoDetectorTest.java)
Copyright Year
:   2011

This check looks through the string definitions, and if it finds any
words that look like likely misspellings, they are flagged.

!!! Tip
   This lint check has an associated quickfix available in the IDE.

(##) Example

Here is an example of lint warnings produced by this check:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text
res/values/strings.xml:6:Warning: "activites" is a common misspelling;
did you mean "activities"? [Typos]
    &lt;string name="s2"&gt;Andriod activites!&lt;/string&gt;
                              ^
res/values/strings.xml:8:Warning: "Cmoputer" is a common misspelling;
did you mean "Computer"? [Typos]
    &lt;string name="s3"&gt; (Cmoputer &lt;/string&gt;
                        ^
res/values/strings.xml:10:Warning: "throught" is a common misspelling;
did you mean "thought" or "through" or "throughout"? [Typos]
    &lt;string name="s4"&gt;&lt;b&gt;throught&lt;/b&gt;&lt;/string&gt;
                         ^
res/values/strings.xml:12:Warning: "Seach" is a common misspelling; did
you mean "Search"? [Typos]
    &lt;string name="s5"&gt;Seach&lt;/string&gt;
                      ^
res/values/strings.xml:16:Warning: "Tuscon" is a common misspelling; did
you mean "Tucson"? [Typos]
    &lt;string name="s7"&gt;Tuscon tuscon&lt;/string&gt;
                      ^
res/values/strings.xml:20:Warning: "Ok" is usually capitalized as "OK"
[Typos]
    &lt;string name="dlg_button_ok"&gt;Ok&lt;/string&gt;
                                 ^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here is the source file referenced above:

`res/values/strings.xml`:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~xml linenumbers
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;resources&gt;
    &lt;!-- No typos --&gt;
    &lt;string name="s1"&gt;Home Sample&lt;/string&gt;
    &lt;!-- Plain typos --&gt;
    &lt;string name="s2"&gt;Andriod activites!&lt;/string&gt;
    &lt;!-- Make capitalization match typo --&gt;
    &lt;string name="s3"&gt; (Cmoputer &lt;/string&gt;
    &lt;!-- Markup indirection --&gt;
    &lt;string name="s4"&gt;&lt;b&gt;throught&lt;/b&gt;&lt;/string&gt;
    &lt;!-- Typo, match capitalized --&gt;
    &lt;string name="s5"&gt;Seach&lt;/string&gt;
    &lt;!-- random words, shouldn't flag --&gt;
    &lt;string name="s6"&gt;abcdefg qwerty asdf jklm&lt;/string&gt;
    &lt;!-- typo, but should only match when capitalized --&gt;
    &lt;string name="s7"&gt;Tuscon tuscon&lt;/string&gt;
    &lt;!-- case changes only: valid --&gt;
    &lt;string name="s8"&gt;OK Cancel dialog with a long message&lt;/string&gt;
    &lt;!-- case changes only: invalid --&gt;
    &lt;string name="dlg_button_ok"&gt;Ok&lt;/string&gt;
    &lt;!-- escaped separator --&gt;
    &lt;string name="issue39599"&gt;"Please take a moment\nto rate ^1"&lt;/string&gt;
    &lt;!-- escaped separator 2 --&gt;
    &lt;string name="issue39599_2"&gt;"\nto&lt;/string&gt;
    &lt;!-- not translatable --&gt;
    &lt;string name="translatable" translatable="false"&gt;"Andriod&lt;/string&gt;
    &lt;!-- don't spell check resource references; not user visible anyway --&gt;
    &lt;string name="issue77269_1"&gt;@android:string/ok&lt;/string&gt;
    &lt;string name="issue77269_2"&gt; @string/cmoputer &lt;/string&gt;
&lt;/resources&gt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can also visit the
[source code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/TypoDetectorTest.java)
for the unit tests for this check to see additional scenarios.

The above example was automatically extracted from the first unit test
found for this lint check, `TypoDetector.testPlainValues`.
To report a problem with this extracted sample, visit
https://issuetracker.google.com/issues/new?component=192708.

(##) Suppressing

You can suppress false positives using one of the following mechanisms:

* Adding the suppression attribute `tools:ignore="Typos"` on the
  problematic XML element (or one of its enclosing elements). You may
  also need to add the following namespace declaration on the root
  element in the XML file if it's not already there:
  `xmlns:tools="http://schemas.android.com/tools"`.

  ```xml
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;resources xmlns:tools="http://schemas.android.com/tools"&gt;
      ...
      &lt;string tools:ignore="Typos" .../&gt;
    ...
  &lt;/resources&gt;
  ```

* Using a special `lint.xml` file in the source tree which turns off
  the check in that folder and any sub folder. A simple file might look
  like this:
  ```xml
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;lint&gt;
      &lt;issue id="Typos" severity="ignore" /&gt;
  &lt;/lint&gt;
  ```
  Instead of `ignore` you can also change the severity here, for
  example from `error` to `warning`. You can find additional
  documentation on how to filter issues by path, regular expression and
  so on
  [here](https://googlesamples.github.io/android-custom-lint-rules/usage/lintxml.md.html).

* In Gradle projects, using the DSL syntax to configure lint. For
  example, you can use something like
  ```gradle
  lintOptions {
      disable 'Typos'
  }
  ```
  In Android projects this should be nested inside an `android { }`
  block.

* For manual invocations of `lint`, using the `--ignore` flag:
  ```
  $ lint --ignore Typos ...`
  ```

* Last, but not least, using baselines, as discussed
  [here](https://googlesamples.github.io/android-custom-lint-rules/usage/baselines.md.html).

<!-- Markdeep: --><style class="fallback">body{visibility:hidden;white-space:pre;font-family:monospace}</style><script src="markdeep.min.js" charset="utf-8"></script><script src="https://morgan3d.github.io/markdeep/latest/markdeep.min.js" charset="utf-8"></script><script>window.alreadyProcessedMarkdeep||(document.body.style.visibility="visible")</script>